package com.citybox.type.enums;

import lombok.Getter;

/**
 * wx
 */
@Getter
public enum WxEnum {

    ACCESS_TOKEN_KEY("applets_accessToken:","redis使用-key"),
    ACCESS_TOKEN("access_token","小程序access_token"),
    EXPIRES_IN("expires_in","access_token过期时间"),
    ;


    private final String code;
    private final String value;

    private WxEnum(final String code, final String value) {
        this.code = code;
        this.value = value;
    }

    public static WxEnum getByCode(final String code) {
        for (WxEnum mode : values()) {
            if (mode.code.equals(code)) {
                return mode;
            }
        }
        return null;
    }

    public static String getValueByCode(final String code) {
        for (WxEnum mode : values()) {
            if (mode.code.equals(code)) {
                return mode.getValue();
            }
        }
        return null;
    }

}
